
local imgs = {
    [[ui\三选一\蓝.tga]],
    [[ui\三选一\紫.tga]],
    [[ui\三选一\金.tga]],
}
class.card_data = extends(class.button) {
    reload = true,
    new = function (parent,x,y,w,h)
        local panel = class.card_data:builder 
        {
            parent = parent,
            x = x,
            y = y,
            w = w,
            h = h,
        }
        return panel
    end,

    init = function (self)
        class.button.init(self)
        self:set_normal_image(imgs[2])
        --self:set_normal_image([[textures\black32.blp]])
        self.highlight = self:add_panel([[UI\选中框.tga]],-10,-10,self.w+20,self.h+20)
        self.highlight:hide()
        self.jb = self:add_text('血牛(1/3)',0,15,nil,30,14,5)
        self.icon = self:add_panel('1',(self.w-64)/2,50,64,64)
        self.frame = self.icon:add_panel('')
        self.title = class.text:builder {
            parent = self,
            y = 120,
            h = 30,
            text = '血牛',
            shadow_offset_x = 2,
            shadow_offset_y = -2,
            shadow_color = 0xff000000,
            outline = true,
            font_size = 13,
            align = 5,
        }
        self.text1 = self:add_text('内容介绍内容介绍内容介绍内容介绍内容介绍内容介绍内容介绍',self.w*0.15,170,self.w*0.7,self.h-200,12,7)
        self.text2 = self:add_text('',self.w*0.15,180,self.w*0.7,self.h-200,11,1)
        self.text2:set_color(0xff999999)
        --自动换行
        return self
    end,
    set_data = function(self,skill)
        local level = skill['等级']
        self.skill = skill
        self:set_normal_image(imgs[level] or imgs[#imgs])
        self.frame:set_normal_image(skill.frame_art)
        self.icon:set_normal_image(skill.art)
        self.title:set_text(format_obj(skill,skill.title or skill.name))
        self.text1:set_text(format_obj(skill,skill.tip))
        self.text2:set_text(format_obj(skill,skill.jb_tip2))
        self.jb:set_text(format_obj(skill,skill.jb_title))
    end,
}

